#ifndef CLIENT_H
#define CLIENT_H

#include <QtNetwork>

class Client : public QObject
{
    Q_OBJECT
public:
    explicit Client();
    
signals:

    /**
     * @brief addServer Emiited when client successfully connected to server.
     * @param host Host name of server.
     * @param port Port of server.
     */
    void addServer(QString host, int port);

    void removeServer(QString host);

private slots:
    /**
     * @brief startPolling Starts polling the servers which config was read from file.
     */
    void startPolling();

    /**
     * @brief connectionEstablished Happens when client successfully connects to server.
     */
    void connectionEstablished();

    void connectionBroken();

public slots:

    /**
     * @brief broadcastMessage Broadcasts message to all connected servers.
     * @param msg Message to broadcast.
     */
    void broadcastMessage(QString msg);

private:

    /**
     * @brief serverConnections Current connections with servers.
     */
    QList<QTcpSocket*> serverConnections;

};

#endif // CLIENT_H
